package com.example.day9lx;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
Spinner s1;
    ArrayAdapter<String> array1,array2,array3;
    String[] str1;
    String[][] str2;
    String[][][] str3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        s1 = findViewById(R.id.s1);
         str1= new String[]{"北京","河北","河南"};
//        String[] str11 = new String[]{"海淀区","昌平区","大兴区"};
//        String[] str12 = new String[]{"邯郸市","石家庄","保定"};
//        String[] str13 = new String[]{"洛阳","顺义","aaa"};
//
//        String[] str111 = new String[]{"上地","啊啊啊","不不不"};
//        String[] str112 = new String[]{"cp","啊啊啊","不不不"};
//        String[] str113 = new String[]{"dx","啊啊啊","不不不"};
//
//        String[] str121 = new String[]{"ly","啊啊啊","不不不"};
//        String[] str122 = new String[]{"cp","啊啊啊","不不不"};
//        String[] str123 = new String[]{"dx","啊啊啊","不不不"};
//        String[] str131 = new String[]{"开封","啊啊啊","不不不"};
//        String[] str132 = new String[]{"sy","啊啊啊","不不不"};
//        String[] str133 = new String[]{"aaa","啊啊啊","不不不"};
        str2 = new String[][]{{"海淀区","昌平区","大兴区"},{"邯郸市","石家庄","保定"},{"洛阳","顺义","aaa"}};
        str3 = new String[][][]{{{"上地","啊啊啊","不不不"},{"cp","啊啊啊","不不不"},{"dx","啊啊啊","不不不"}},{{"hd","啊啊啊","不不不"},{"sjz","啊啊啊","不不不"},{"bd","啊啊啊","不不不"}},{{"ly","啊啊啊","不不不"},{"sy","啊啊啊","不不不"},{"aaa","啊啊啊","不不不"}}};

        array1 = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,str1);
        s1.setAdapter(array1);

        s1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                for (int i = 0;i<str1.length;i++){

                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });
    }

//    @Override
//    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
//        String str = s1.getItemAtPosition(position).toString();
//        Toast.makeText(MainActivity.this,"选择了"+str,Toast.LENGTH_SHORT).show();
//    }
//
//    @Override
//    public void onNothingSelected(AdapterView<?> parent) {
//
//    }
}
